package com.hbpa.pan.core.exception;

import com.hbpa.pan.core.response.ResponseCode;
import lombok.Data;

/**
 * @author: BlcakTiger
 * @date: 2023/10/14 14:41
 * @contact: hsf6661@163.com
 * @description: 自定义项目全局业务异常类
 */
@Data
public class RPanBusinessException extends RuntimeException {

    /**
     * 异常码
     */
    private Integer code;
    /**
     * 异常信息
     */
    private String message;

    public RPanBusinessException(){
        this.code = ResponseCode.ERROR_PARAM.getCode();
        this.message = ResponseCode.ERROR_PARAM.getDesc();
    }

    public RPanBusinessException(ResponseCode responseCode){
        this.code = responseCode.getCode();
        this.message = responseCode.getDesc();
    }

    public RPanBusinessException(Integer code,String message){
        this.code = code;
        this.message = message;
    }

    public RPanBusinessException(String message){
        this.code = ResponseCode.ERROR_PARAM.getCode();
        this.message = message;
    }
}
